//
//  JLHomeTopItem.m
//  Liang美团HD
//
//  Created by sun on 16/1/20.
//  Copyright © 2016年 sun. All rights reserved.
//

#import "JLHomeTopItem.h"
@interface JLHomeTopItem()

@property (weak, nonatomic) IBOutlet UILabel *title;
@property (weak, nonatomic) IBOutlet UILabel *subTitle;
@property (weak, nonatomic) IBOutlet UIButton *iconButton;
@end
@implementation JLHomeTopItem
+ (instancetype)itemWithTitle:(NSString *)title subTitle:(NSString *)subTitle norImage:(NSString *)norImage highImage:(NSString *)highImage target:(id)target action:(SEL)action{
    JLHomeTopItem * item = [[NSBundle mainBundle] loadNibNamed:@"JLHomeTopItem" owner:nil options:nil].firstObject;
    
    item.title.text = title;
    item.subTitle.text = subTitle;
    [item.iconButton setImage:[UIImage imageNamed:norImage] forState:UIControlStateNormal];
    [item.iconButton setImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
    [item.iconButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    return item;
}
-(void)awakeFromNib{
    self.autoresizingMask = NO;
}
-(void)setText:(NSString *)text{
    self.title.text = text;
}
-(void)setSubText:(NSString *)subText{
    self.subTitle.text = subText;
}
-(NSString *)text{
    return self.title.text;
}
-(NSString *)subText{
    return self.subTitle.text;
}
@end
